package com.mpyy.service.inventory;

import com.mpyy.dao.inventory.ProductInfoMapperDaoInter;
import com.mpyy.pojo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service(value = "productInfoMapperServiceImpl")
public class ProductInfoMapperServiceImpl implements ProductInfoMapperServiceInter {
    @Autowired
    @Qualifier(value = "productInfoMapperDaoInter")
    private ProductInfoMapperDaoInter productInfoMapperDaoInter;

    @Override
    public List<ProductInfo> showAllProductInfoCollect(ProductInfo productInfo) {
        List<ProductInfo> productInfos = productInfoMapperDaoInter.showAllProductInfoCollect(productInfo);
        return productInfos;
    }

    /*查询仓库表信息*/
    @Override
    public List<DepotInfo> searchDepotInfo() {
        List<DepotInfo> depotInfos = productInfoMapperDaoInter.searchDepotInfo();
        return depotInfos;
    }

    /*查询员工表信息*/
    @Override
    public List<EmployeeInfo> searchEmployeeInfo() {
        List<EmployeeInfo> employeeInfos = productInfoMapperDaoInter.searchEmployeeInfo();
        return employeeInfos;
    }

    /*查询仓库明细表信息*/
    @Override
    public List<InventoryDesc> searchInventoryDescInfo(InventoryDesc inventoryDesc) {
        List<InventoryDesc> inventoryDescs = productInfoMapperDaoInter.searchInventoryDescInfo(inventoryDesc);
        return inventoryDescs;
    }

    /*查询商品批次信息*/
    @Override
    public List<InventoryDesc> searchCommodityBatch(String proId) {
        List<InventoryDesc> inventoryDescs = productInfoMapperDaoInter.searchCommodityBatch(proId);
        return inventoryDescs;
    }

    /*库存调拨情况列表*/
    @Override
    public List<InventoryAllocation> searchInventoryAllocationInfo(InventoryAllocation inventoryAllocation) {
        List<InventoryAllocation> inventoryAllocations = productInfoMapperDaoInter.searchInventoryAllocationInfo(inventoryAllocation);
        return inventoryAllocations;
    }

    /*库存调拨情况根据时间*/
    @Override
    public List<InventoryAllocation> searchInventoryAllocationInfoData(InventoryAllocation inventoryAllocation) {
        List<InventoryAllocation> inventoryAllocations = productInfoMapperDaoInter.searchInventoryAllocationInfoData(inventoryAllocation);
        return inventoryAllocations;
    }

    /*查询库存调拨明细表的信息*/
    @Override
    public List<InventoryAllocationDesc> searchInventoryAllocationDescInfo(String invAllotId) {
        List<InventoryAllocationDesc> inventoryAllocationDescs = productInfoMapperDaoInter.searchInventoryAllocationDescInfo(invAllotId);
        return inventoryAllocationDescs;
    }

    /*新增一条库存调拨信息*/
    @Override
    public int updateInventoryAllocation(InventoryAllocation inventoryAllocation) {
        int i = productInfoMapperDaoInter.updateInventoryAllocation(inventoryAllocation);
        return i;
    }

    /*新增库存调拨明细表信息*/
    @Override
    public int updateInventoryAllocationDesc(InventoryAllocationDesc inventoryAllocationDesc) {
        int i = productInfoMapperDaoInter.updateInventoryAllocationDesc(inventoryAllocationDesc);
        return i;
    }

    /*修改调出仓库的商品信息*/
    @Override
    public int updateInventoryDescNumber(InventoryDesc inventoryDesc) {
        int i = productInfoMapperDaoInter.updateInventoryDescNumber(inventoryDesc);
        return i;
    }

    /*根据仓库编号和商品编号查询指定库存明细表中是否有这件商品*/
    @Override
    public List<InventoryDesc> searchInventoryDescInfoAssign(InventoryDesc inventoryDesc) {
        List<InventoryDesc> inventoryDescs = productInfoMapperDaoInter.searchInventoryDescInfoAssign(inventoryDesc);
        return inventoryDescs;
    }

    /*调入仓库商品不存在这个仓库 对这件商品在这个仓库做新增操作*/
    @Override
    public int updateInventoryDescIn(InventoryDesc inventoryDesc) {
        int i = productInfoMapperDaoInter.updateInventoryDescIn(inventoryDesc);
        return i;
    }
}
